/**
 * www.yiji.com Inc.
 * Copyright (c) 2012 All Rights Reserved.
 */
package com.zqxq.common.base;


import com.zqxq.common.bo.Order;

import java.io.Serializable;


public class YrdDomainHolder implements Serializable {
	
	private static final long						serialVersionUID	= -6099836956384599949L;
	
	private static ThreadLocal<YrdDomainContext<?>>	contextLocal		= new ThreadLocal<YrdDomainContext<?>>();
	
	public YrdDomainHolder() {
	}
	
	/**
	 * 获取上下文
	 * @return Returns the ContractContext
	 */
	@SuppressWarnings("unchecked")
	public static <T extends Order> YrdDomainContext<T> get() {
		return (YrdDomainContext<T>) contextLocal.get();
	}
	
	/**
	 * 赋予上下文
	 */
	public static <T extends Order> void set(YrdDomainContext<T> context) {
		contextLocal.set(context);
	}
	
	/**
	 * 清理充值上下文
	 */
	public static void clear() {
		contextLocal.set(null);
	}
}
